using System.Collections.Generic;

namespace SharePointUtilitiesForDevelopers.Repository
{
    /// <summary>
    /// Defines the interface for a repository for working with lists.
    /// </summary>
    public interface ISharePointListRepository
    {

        /// <summary>
        /// Deletes list items in the specified list / view.
        /// </summary>
        /// <param name="siteUrl">The site URL.</param>
        /// <param name="listName">Name of the list.</param>
        /// <param name="viewName">Name of the view.</param>
        /// <param name="queryXml">The query Xml.</param>
        /// <param name="batchSize">Size of the batch.</param>
        void DeleteListItems(
            string siteUrl,
            string listName,
            string viewName,
            string queryXml,
            int batchSize);

        /// <summary>
        /// Gets the list items.
        /// </summary>
        /// <param name="siteUrl">The site URL.</param>
        /// <param name="listName">Name of the list.</param>
        /// <param name="viewName">Name of the view.</param>
        /// <param name="queryXml">The query Xml.</param>
        /// <param name="viewFieldsXml">The viewfields Xml.</param>
        /// <param name="rowLimit">The row limit.</param>
        /// <param name="queryOptionsXml">The query options Xml.</param>
        /// <param name="webId">The web id.</param>
        /// <returns>A list <see cref="SharePointListItem"/> objects.</returns>
        IEnumerable<SharePointListItem> GetListItems(
            string siteUrl, 
            string listName, 
            string viewName, 
            string queryXml, 
            string viewFieldsXml, 
            int? rowLimit, 
            string queryOptionsXml, 
            string webId);

        /// <summary>
        /// Gets the lists in the specified web.
        /// </summary>
        /// <param name="siteUrl">The site URL.</param>
        /// <returns>A list of <see cref="SharePointList"/> objects.</returns>
        IEnumerable<SharePointList> GetLists(string siteUrl);

        /// <summary>
        /// Gets the list views.
        /// </summary>
        /// <param name="siteUrl">The site URL.</param>
        /// <param name="listName">Name of the list.</param>
        /// <returns>A list of views.</returns>
        IEnumerable<SharePointListView> GetListViews(string siteUrl, string listName);

        /// <summary>
        /// Gets the list view.
        /// </summary>
        /// <param name="siteUrl">The site URL.</param>
        /// <param name="listName">Name of the list.</param>
        /// <param name="viewName">Name of the view.</param>
        /// <returns>A list view./returns>
        SharePointListView GetListView(string siteUrl, string listName, string viewName);

        /// <summary>
        /// Gets the list content types.
        /// </summary>
        /// <param name="siteUrl">The site URL.</param>
        /// <param name="listName">Name of the list.</param>
        /// <returns>The list content types</returns>
        IEnumerable<SharePointContentType> GetListContentTypes(string siteUrl, string listName);

        /// <summary>
        /// Gets the list content type.
        /// </summary>
        /// <param name="siteUrl">The site URL.</param>
        /// <param name="listName">Name of the list.</param>
        /// <param name="contentTypeId">The content type id.</param>
        /// <returns>The list content type.</returns>
        SharePointContentType GetListContentType(string siteUrl, string listName, string contentTypeId);

        /// <summary>
        /// Gets the list fields.
        /// </summary>
        /// <param name="siteUrl">The site URL.</param>
        /// <param name="listName">Name of the list.</param>
        /// <returns>The list fields.</returns>
        IEnumerable<SharePointField> GetListFields(string siteUrl, string listName);

        /// <summary>
        /// Gets the list custom fields.
        /// </summary>
        /// <param name="fields">The fields.</param>
        /// <param name="listName">Name of the list.</param>
        /// <returns>The list of custom fields.</returns>
        IEnumerable<SharePointField> GetListCustomFields(IEnumerable<SharePointField> fields, string listName);

        /// <summary>
        /// Gets the list.
        /// </summary>
        /// <param name="siteUrl">The site URL.</param>
        /// <param name="listName">Name of the list.</param>
        /// <param name="options">The options.</param>
        SharePointList GetList(string siteUrl, string listName, SharePointListLoadOptions options);

        /// <summary>
        /// Gets the web lists.
        /// </summary>
        /// <param name="siteUrl">The site URL.</param>
        /// <returns>A list of lists in the web.</returns>
        IEnumerable<SharePointList> GetWebLists(string siteUrl);

        /// <summary>
        /// Gets the web site user list.
        /// </summary>
        /// <param name="siteUrl">The site URL.</param>
        /// <returns>The site user list for the specified site.</returns>
        SharePointList GetWebSiteUserInfoList(string siteUrl);

        /// <summary>
        /// Loads the list fields.
        /// </summary>
        /// <param name="list">The list.</param>
        /// <param name="siteUrl">The site URL.</param>
        void LoadListFields(SharePointList list, string siteUrl);

        /// <summary>
        /// Loads the list content types.
        /// </summary>
        /// <param name="list">The list.</param>
        /// <param name="siteUrl">The site URL.</param>
        void LoadListContentTypes(SharePointList list, string siteUrl);

        /// <summary>
        /// Loads the list views.
        /// </summary>
        /// <param name="list">The list.</param>
        /// <param name="siteUrl">The site URL.</param>
        void LoadListViews(SharePointList list, string siteUrl);
    }
}